<?php

namespace App\Models\Store\User;

class UserModel extends BaseUserModel
{
    protected $table = 'users';

    const STATUS_DEFAULT    = 0; // 正常状态
    const STATUS_WAIT_APPLY = 1; // 未审核

    /**
     * 根据手机号获取用户
     * @param string $phone
     * @param array $fields
     * @return array
     */
    public function getItemByPhone(string $phone, array $fields = self::QUERY_DEFAULT_FIELDS): array
    {
        $result = $this->select($fields)
                       ->where('phone', $phone)
                       ->first();
        return $result ? $result->toArray() : [];
    }
}
